x11: Defer _NET_WM_FRAME_DRAWN update until frame usable by compositor
authorRay Strode <rstrode@redhat.com>
Wed, 27 May 2020 19:12:35 +0000 (15:12 -0400)
committerRay Strode <rstrode@redhat.com>
Fri, 5 Jun 2020 14:01:13 +0000 (10:01 -0400)
commit972134abe48a4c9c7b6ad41b0723f30f4e7ae16b
tree22ca1f74a6238bafd877571c087f2450d4413175
parentf8770b78ea87751407f94e39282eeca3ba04ca09
x11: Defer _NET_WM_FRAME_DRAWN update until frame usable by compositor

With the vendor provided Nvidia driver there is a small window of time
after drawing to a GL surface before the updates to that surface
can be used by the compositor.

Drawing is already coordinated with the compositor through the frame
synchronization protocol detailed here:

https://fishsoup.net/misc/wm-spec-synchronization.html

Unfortunately, at the moment, GdkX11Surface tells the compositor the
frame is ready immediately after drawing to the surface, not later,
when it's consumable by the compositor.

This commit defers announcing the frame as ready until it's consumable
by the compositor. It does this by listening for the X server to announce
damage events associated with the frame drawing.  It tries to find the
right damage event by waiting until fence placed at buffer swap time
signals.
gdk/x11/gdkdisplay-x11.h
gdk/x11/gdkglcontext-x11.c
gdk/x11/gdkglcontext-x11.h
gdk/x11/gdkprivate-x11.h
gdk/x11/gdksurface-x11.c
gdk/x11/gdksurface-x11.h